﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.Master" AutoEventWireup="true"
    CodeBehind="JT_CompanyAdd.aspx.cs" Inherits="JTicket.UI.JT_CompanyAdd" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script type="text/javascript">
    //页面初始下载
    $(document).ready(
    function () {
        if (Flag == "Edite") {
            $("#BtnAdd").hide(); 
            JTicket.UI.Service.JT_ComanySvc.Model(ID,
        function Success(Reuslt) {
            if (Reuslt != null) {
                $("#txtCompayCode").val(Reuslt.ComanyCode);
                $("#txtCompayName").val(Reuslt.ComanyName);
                $("#txtcoy").val(Reuslt.ComanyCopy);
                $("#txtcontant").val(Reuslt.CContact);
                $("#txttel").val(Reuslt.CTel);
                $("#txtaddress").val(Reuslt.CAddress);
                $("#txtfav").val(Reuslt.CFav);
                $("#txtinfo").val(Reuslt.CInfo);
                $("#txttel").val(Reuslt.CTel);
                $("#txtremake").val(Reuslt.CRemake);
            } else {
                window.location.href = "JT_CompanyManager.aspx";
            }
        },
         function Fail(Reuslt) { alert(Reuslt.get_message()); });
        } else {
            $("#BtnEdite").hide();
        }
    });
    //添加
    function Add() {
        var model = new JTicket.Model.C_CompanyInfo();
        model.ComanyCode = $("#txtCompayCode").attr("value");
        model.ComanyName = $("#txtCompayName").attr("value");
        model.ComanyCopy = $("#txtcoy").attr("value");
        model.CContact = $("#txtcontant").attr("value");
        model.CTel = $("#txttel").attr("value");
        model.CFav = $("#txtfav").attr("value");
        model.CAddress = $("#txtaddress").attr("value");
        model.CInfo = $("#txtinfo").attr("value");
        model.CRemake = $("#txtremake").attr("value");
        model.CState = 0;
        if ($("[name='chState']").check) {
            model.CState = 1;
        }
        JTicket.UI.Service.JT_ComanySvc.Add(model,
            function Success(Result) { alert(Result); },
            function fail(Result) { isAlertError(); });
    }
    //修改
    function Update() {
        var model = new JTicket.Model.C_CompanyInfo();
        model.ComanyCode = $("#txtCompayCode").attr("value");
        model.ComanyName = $("#txtCompayName").attr("value");
        model.ComanyCopy = $("#txtcoy").attr("value");
        model.CContact = $("#txtcontant").attr("value");
        model.CTel = $("#txttel").attr("value");
        model.CFav = $("#txtfav").attr("value");
        model.CAddress = $("#txtaddress").attr("value");
        model.CInfo = $("#txtinfo").attr("value");
        model.CRemake = $("#txtremake").attr("value");
        model.CState = 0;
        if ($("[name='chState']").check) {
            model.CState = 1;
        }
        JTicket.UI.Service.JT_ComanySvc.Update(model,
            function Success(Result) { alert("修改成功！"); },
            function fail() { });
    }
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:ScriptManager ID="sm" runat="server">
<Services>
<asp:ServiceReference InlineScript="true" Path="~/Service/JT_ComanySvc.asmx" />
</Services>
</asp:ScriptManager>
    <table align="center" border="0" cellpadding="4" cellspacing="1" class="toptable grid"
        width="100%">
        <tr>
            <td class="category t2" height="25" width="100">
                企业添加
            </td>
            <td class="category" height="25">
            </td>
        </tr>
    </table>
    <table cellpadding="1" cellspacing="1" id="TbInfo" class="TbInfo">
        <tr>
            <td align="right" bgcolor="#3890B5" class="B" style="width: 130px">
                名称
            </td>
            <td height="25" align="right" bgcolor="#3890B5" class="B">
                操作
            </td>
            <td align="right" bgcolor="#3890B5" class="B" style="width: 50px">
                说明
            </td>
        </tr>
        <tr>
            <td align="center" bgcolor="#F6F6F6" style="width: 130px; height: 25px;">
                企业编号：
            </td>
            <td align="left" bgcolor="#F6F6F6" style="height: 25px">
                <input id="txtCompayCode" type="text" /></td>
            <td bgcolor="#F6F6F6" style="height: 25px; width: 171px;">
                必填
            </td>
        </tr>
        <tr>
            <td align="center" bgcolor="#F6F6F6" style="width: 130px; height: 25px;">
                企业名称：
            </td>
            <td align="left" bgcolor="#F6F6F6" style="height: 25px">
                <input id="txtCompayName" type="text"  style="width: 300px;"  />
            </td>
            <td bgcolor="#F6F6F6" style="height: 25px; width: 171px;">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td align="center" bgcolor="#F6F6F6" style="width: 130px; height: 25px;">
                企业地址：
            </td>
            <td align="left" bgcolor="#F6F6F6" style="height: 25px">
                <input id="txtaddress" type="text" style="width: 300px;" />
            </td>
            <td bgcolor="#F6F6F6" style="height: 25px; width: 171px;">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td align="center" bgcolor="#F6F6F6" style="width: 130px; height: 25px;">
                企业联系人：</td>
                <td align="left" bgcolor="#F6F6F6" style="height: 25px">
                    <input id="txtcontant" type="text" />
                </td>
                <td bgcolor="#F6F6F6" style="height: 25px; width: 171px;">
                    &nbsp;
                </td>
        </tr>
        <tr>
            <td align="center" bgcolor="#F6F6F6" style="width: 130px;">
                企业电话：
            </td>
            <td bgcolor="#F6F6F6" style="width: 130px;">
                <input id="txttel" type="text" />
            </td>
            <td bgcolor="#F6F6F6" style="width: 171px;">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td align="center" bgcolor="#F6F6F6" style="width: 130px;">
                企业传真：
            </td>
            <td bgcolor="#F6F6F6" style="width: 130px;">
                <input id="txtfav" type="text" />
            </td>
            <td bgcolor="#F6F6F6" style="width: 171px;">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td align="center" bgcolor="#F6F6F6" style="width: 130px;">
                企业版权：
            </td>
            <td bgcolor="#F6F6F6" style="width: 130px;">
                <input id="txtcoy" type="text" />
            </td>
            <td bgcolor="#F6F6F6" style="width: 171px;">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td align="center" bgcolor="#F6F6F6" style="width: 130px;">
                企业简介：
            </td>
            <td bgcolor="#F6F6F6" style="width: 130px;">
                <textarea id="txtinfo" class="textarea" cols="20" name="S2" rows="2"></textarea>
            </td>
            <td bgcolor="#F6F6F6" style="width: 171px;">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td align="center" bgcolor="#F6F6F6" style="width: 130px;">
                备注：
            </td>
            <td bgcolor="#F6F6F6" style="width: 130px;">
                <textarea id="txtremake" class="textarea" cols="20" name="S1" rows="2"></textarea>
            </td>
            <td bgcolor="#F6F6F6" style="width: 171px;">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td align="center" bgcolor="#f6f6f6" style="height: 27px; width: 130px;">
                启用状态：
            </td>
            <td align="left" bgcolor="#f6f6f6" style="height: 27px; width: 130px;">
                <input  id="chState" value="启用" checked="checked"  type="checkbox" 
                    class="checkbox"/>
                 
                启用</td>
            <td bgcolor="#f6f6f6" style="height: 27px; width: 171px;">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td align="center" bgcolor="#F6F6F6" style="width: 130px">
            </td>
            <td height="25" bgcolor="#F6F6F6" align="center">
                <input type="button" id="BtnAdd" value="添  加" onclick="Add();" onmousemove="showBtnOver(this)"
                    onmouseout="showBtnOut(this)" class="submitMiniGreen"  />
                    <input type="button" id="BtnEdite" value="修  改"
                 onclick="Update();"
                    onmousemove="showBtnOver(this)" onmouseout="showBtnOut(this)" class="submitMiniGreen" />
           <input type="button" id="BtnBack" value="返  回"
                 onclick="javascript:window.location.href ='JT_CompanyManager.aspx'"
                    onmousemove="showBtnOver(this)" onmouseout="showBtnOut(this)" class="submitMiniGreen" /> </td>
            <td bgcolor="#F6F6F6" style="width: 171px">
                &nbsp;
            </td>
        </tr>
    </table>
</asp:Content>
